﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PlaystationNetworkAPI.Core
{
    public class Collector
    {
        public static PsnProfile GetPsnProfile(string psnId, string location)
        {
            switch (location)
            {
                case "US":
                    return GetUSPsnProfile(psnId);

                default:
                    return GetUSPsnProfile(psnId);
            }
        }

        internal static PsnProfile GetUSPsnProfile(string psnId)
        {
            Core.US.Collector usCollector = new US.Collector(psnId);
            Core.US.Parser usParser = new US.Parser(usCollector.TrophiesHtml);

            TrophyCount collectedTrophyCount = new TrophyCount(
                usParser.GetBronzeTrohies(),
                usParser.GetSilverTrohies(),
                usParser.GetGoldTrophies(),
                usParser.GetPlatinumTrophies(),
                usParser.GetTotalTrophies()
                );

            PsnProfile collectedPsnProfile = new PsnProfile(
                usParser.GetPsnId(),
                usParser.GetLevel(),
                usParser.GetProgress(),
                collectedTrophyCount
                );

            return collectedPsnProfile;
        }
    }
}
